<template>
    <view>
        <!--标题和返回-->
		<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName">
			<block slot="backText">返回</block>
			<block slot="content">exce_plan</block>
		</cu-custom>
		 <!--表单区域-->
		<view>
			<form>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">序号：</text></view>
                  <input type="number" placeholder="请输入序号" v-model="model.noId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">下达日期：</text></view>
                  <input  placeholder="请输入下达日期" v-model="model.issDate"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">是否居配：</text></view>
                  <input  placeholder="请输入是否居配" v-model="model.isMatch"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">合同号：</text></view>
                  <input  placeholder="请输入合同号" v-model="model.contractNumber"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">销售人：</text></view>
                  <input  placeholder="请输入销售人" v-model="model.seller"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">客户名称：</text></view>
                  <input  placeholder="请输入客户名称" v-model="model.customer"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">项目名称：</text></view>
                  <input  placeholder="请输入项目名称" v-model="model.projectName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">合同内容：</text></view>
                  <input  placeholder="请输入合同内容" v-model="model.contractContent"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">产品类型：</text></view>
                  <input  placeholder="请输入产品类型" v-model="model.projectType"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">产品数量：</text></view>
                  <input type="number" placeholder="请输入产品数量" v-model="model.productNum"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">关注点：</text></view>
                  <input  placeholder="请输入关注点" v-model="model.concerns"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">用户要求时间（预计结束时间）：</text></view>
                  <input  placeholder="请输入用户要求时间（预计结束时间）" v-model="model.planEndTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">排产后时间：</text></view>
                  <input  placeholder="请输入排产后时间" v-model="model.productAfterTime"/>
                </view>
              </view>
              <my-date label="调整后时间：" v-model="model.dateAdjustAfterTime" placeholder="请输入调整后时间"></my-date>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">调整后时间：</text></view>
                  <input  placeholder="请输入调整后时间" v-model="model.adjustAfterTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">甲供到货时间：</text></view>
                  <input  placeholder="请输入甲供到货时间" v-model="model.sendTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">长货期物料：</text></view>
                  <input  placeholder="请输入长货期物料" v-model="model.longGoodsTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">一次料单：</text></view>
                  <input  placeholder="请输入一次料单" v-model="model.oneMaterList"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">二次物料是否完成0:未完成，1：已逾期：2:已完成,3：即将逾期：</text></view>
                  <input type="number" placeholder="请输入二次物料是否完成0:未完成，1：已逾期：2:已完成,3：即将逾期" v-model="model.comTwoMater"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">二次料单：</text></view>
                  <input  placeholder="请输入二次料单" v-model="model.twoMaterList"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">甲供件资料：</text></view>
                  <input  placeholder="请输入甲供件资料" v-model="model.sendFileTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">辅料：</text></view>
                  <input  placeholder="请输入辅料" v-model="model.ingredientsTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">屏面图：</text></view>
                  <input  placeholder="请输入屏面图" v-model="model.panelDrawing"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">单线图：</text></view>
                  <input  placeholder="请输入单线图" v-model="model.singleLineDrawing"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">原理图是否完成0:未完成，1：已逾期：2:已完成，3：即将逾期：</text></view>
                  <input type="number" placeholder="请输入原理图是否完成0:未完成，1：已逾期：2:已完成，3：即将逾期" v-model="model.comSchemDrawing"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">原理图：</text></view>
                  <input  placeholder="请输入原理图" v-model="model.schemDrawing"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">自制件BOM,0:未完成，1：已逾期：2:已完成，3：即将逾期：</text></view>
                  <input type="number" placeholder="请输入自制件BOM,0:未完成，1：已逾期：2:已完成，3：即将逾期" v-model="model.comSelfBom"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">自制件BOM：</text></view>
                  <input  placeholder="请输入自制件BOM" v-model="model.selfRestraintBom"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">外协件：</text></view>
                  <input  placeholder="请输入外协件" v-model="model.outsourcePart"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">铜材预估：</text></view>
                  <input  placeholder="请输入铜材预估" v-model="model.copperProductTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">铜排bom是否完成0:未完成，1：已逾期：2:已完成，3：即将逾期：</text></view>
                  <input type="number" placeholder="请输入铜排bom是否完成0:未完成，1：已逾期：2:已完成，3：即将逾期" v-model="model.comCopperCableBom"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">铜排bom：</text></view>
                  <input  placeholder="请输入铜排bom" v-model="model.copperCableBom"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">电气工程师：</text></view>
                  <input  placeholder="请输入电气工程师" v-model="model.eleEngineer"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">结构工程师：</text></view>
                  <input  placeholder="请输入结构工程师" v-model="model.struEngineer"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">柜体到货：</text></view>
                  <input  placeholder="请输入柜体到货" v-model="model.cabArriveTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">元器件到货：</text></view>
                  <input  placeholder="请输入元器件到货" v-model="model.eleDeviceTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">例外信息：</text></view>
                  <input  placeholder="请输入例外信息" v-model="model.exceInfo"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">镀金加工：</text></view>
                  <input  placeholder="请输入镀金加工" v-model="model.gilding"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">喷涂：</text></view>
                  <input  placeholder="请输入喷涂" v-model="model.spray"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">铜排加工：</text></view>
                  <input  placeholder="请输入铜排加工" v-model="model.copperProcess"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">搪锡：</text></view>
                  <input  placeholder="请输入搪锡" v-model="model.upTin"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">包装方式：</text></view>
                  <input  placeholder="请输入包装方式" v-model="model.packageType"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">0:未完成，1:已完成，2:已逾期，3:已放弃：</text></view>
                  <input  placeholder="请输入0:未完成，1:已完成，2:已逾期，3:已放弃" v-model="model.isComplete"/>
                </view>
              </view>
				<view class="padding">
					<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit">
						<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交
					</button>
				</view>
			</form>
		</view>
    </view>
</template>

<script>
    import myDate from '@/components/my-componets/my-date.vue'

    export default {
        name: "ExcePlanForm",
        components:{ myDate },
        props:{
          formData:{
              type:Object,
              default:()=>{},
              required:false
          }
        },
        data(){
            return {
				CustomBar: this.CustomBar,
				NavBarColor: this.NavBarColor,
				loading:false,
                model: {},
                backRouteName:'index',
                url: {
                  queryById: "/excePlan/excePlan/queryById",
                  add: "/excePlan/excePlan/add",
                  edit: "/excePlan/excePlan/edit",
                },
            }
        },
        created(){
             this.initFormData();
        },
        methods:{
           initFormData(){
               if(this.formData){
                    let dataId = this.formData.dataId;
                    this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{
                        if(res.data.success){
                            console.log("表单数据",res);
                            this.model = res.data.result;
                        }
                    })
                }
            },
            onSubmit() {
                let myForm = {...this.model};
                this.loading = true;
                let url = myForm.id?this.url.edit:this.url.add;
				this.$http.post(url,myForm).then(res=>{
				   console.log("res",res)
				   this.loading = false
				   this.$Router.push({name:this.backRouteName})
				}).catch(()=>{
					this.loading = false
				});
            }
        }
    }
</script>
